from time import sleep

from VAR.BOOK_HOUSE_VAR import *
from key_word.KeyWord import WebKeys
from locater.allPages import *
from logic.loginPage import LoginPage


class SingleCenter(WebKeys):
    def enter_single_center(self,pay_method,pay_amount):
        # 登录 前置条件
        login = LoginPage(self.driver)
        login.login(LOGIN_URL,USERNAME,PASSWD)
        sleep(2)
        # 进入个人中心
        self.locator_with_wait(*page_single_center_entrance).click()
        # 点击立即充值
        self.locator_with_wait(*page_single_center_recharge).click()
        # 选择支付宝支付方式
        page_single_center_pay_method = (By.XPATH,f"//img[@alt='{pay_method}支付']")
        self.locator_with_wait(*page_single_center_pay_method).click()
        # 选择金额
        page_single_center_pay_amount = (By.XPATH,f"//li[@vals='{pay_amount}']")
        self.locator_with_wait(*page_single_center_pay_amount).click()
        sleep(5)


